class Solution
{
public:
    int inventoryManagement(vector<int>& stock)
    {
        unordered_map <int, int> m;
        for (int n : stock)
            if (++m[n] > stock.size() / 2)
                return n;
        return -1;
    }
};